/*import { useSessionStore } from "@/session/sessionStore"
import CryptoJS from "crypto-js"

export function generate_AES_key(length: number = 16): string {
    const enabled_char = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
    let result = ""
    for (let i = length; i > 0; --i)
        result += enabled_char[Math.floor(Math.random() * enabled_char.length)]
    return result
}

export function AES_encryption(data: string, AES_key: string = "") {
    const key = CryptoJS.enc.Utf8.parse(AES_key)
    const srcs = CryptoJS.enc.Utf8.parse(data)
    const encrypted = CryptoJS.AES.encrypt(srcs, key, {
        mode: CryptoJS.mode.ECB,
        padding: CryptoJS.pad.Pkcs7
    })
    return encrypted.toString()
}

export function AES_decryption(data: string, AES_key: string = "") {
    const key = CryptoJS.enc.Utf8.parse(AES_key)
    const decrypted = CryptoJS.AES.decrypt(data, key, { mode: CryptoJS.mode.ECB }).toString(
        CryptoJS.enc.Utf8
    )
    return decrypted
}

export function silver_encryption(data: object | string): string {
    //const sessionStore = useSessionStore()
    if (typeof data == "object") {
        data = JSON.stringify(data)
    }
    //const enc: string = AES_encryption(data, sessionStore.AES_Key)
    return enc
}
export function silver_decryption(
    data: string,
    dec_convert_to_json: boolean = false
): string | object {
    const sessionStore = useSessionStore()
    const dec: string = AES_decryption(data, sessionStore.AES_Key)
    if (dec_convert_to_json) {
        return JSON.parse(dec)
    }
    return dec
}
*/